import socket

# Create a socket object
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Define the host and port
host = '127.0.0.1'
port = 9999

# Connect to the server
client_socket.connect((host, port))

while True:
    # Send data to the server
    client_socket.send(input('我说：').encode('utf-8'))

    # Receive data from the server
    data = client_socket.recv(1024)
    print('Received from server: ', data.decode('utf-8'))


